Initializes a new instance of the EntitySpan class.
Syntax
Parameters
- entityRelationLinks
- One or more entity relation links
Exceptions
Example
C# | Copy Code |
---|
public void FindEntityGraph() {
DomainModelEntityManager mgr = new DomainModelEntityManager();
// Preload some data into cache for this example.
var emp = mgr.Employees.Where(e => e.Id == 1).Include("OrderSummaries.OrderDetails.Product").ToList().First();
// Get an order for this example.
OrderSummary anOrder = mgr.FindEntities<OrderSummary>(EntityState.Unchanged).First();
// Now retrieve an object graph for the selected order.
var roots = new List<Entity> { anOrder };
// Add spans - we want a) employee for the order, and b) order details and their products.
// This requires 2 spans.
EntitySpan span1 = new EntitySpan(EntityRelations.FK_OrderSummary_Employee.ToRole1Link);
EntitySpan span2 = new EntitySpan(EntityRelations.FK_Order_Details_Orders.ToRole2Link,
EntityRelations.FK_Order_Details_Products.ToRole1Link);
var spans = new List<EntitySpan> { span1, span2 };
// Get entity graph.
var entityGraph = mgr.FindEntityGraph(roots, spans, EntityState.Unchanged);
} |
Remarks
Requirements
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family
See Also